/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface CoreYwlx extends BasicModel<CoreYwlx> {
  ywlxLxmc?: string; // 类型名称
  ywlxJclc?: number; // 基础里程
  ywlxJcsz?: number; // 基础时长
  createByName?: string; // 创建人
  updateByName?: string; // 修改人
}

export const coreYwlxList = (params?: CoreYwlx | any) =>
  defHttp.get<CoreYwlx>({ url: adminPath + '/bas/ywlx/coreYwlx/list', params });

export const coreYwlxListData = (params?: CoreYwlx | any) =>
  defHttp.post<Page<CoreYwlx>>({ url: adminPath + '/bas/ywlx/coreYwlx/listData', params });

export const coreYwlxForm = (params?: CoreYwlx | any) =>
  defHttp.get<CoreYwlx>({ url: adminPath + '/bas/ywlx/coreYwlx/form', params });

export const coreYwlxSave = (params?: any, data?: CoreYwlx | any) =>
  defHttp.postJson<CoreYwlx>({ url: adminPath + '/bas/ywlx/coreYwlx/save', params, data });

export const coreYwlxImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/ywlx/coreYwlx/importData',
      onUploadProgress,
    },
    params,
  );

export const coreYwlxDelete = (params?: CoreYwlx | any) =>
  defHttp.get<CoreYwlx>({ url: adminPath + '/bas/ywlx/coreYwlx/delete', params });

export const coreYwlxTreeData = (params?: CoreYwlx | any) =>
  defHttp.get<CoreYwlx>({ url: adminPath + '/bas/ywlx/coreYwlx/treeData', params });
